package com.huike.web.controller.contract;

import com.huike.common.annotation.Log;
import com.huike.common.core.controller.BaseController;
import com.huike.common.core.domain.AjaxResult;
import com.huike.common.core.domain.entity.SysUser;
import com.huike.common.core.page.TableDataInfo;
import com.huike.common.enums.BusinessType;
import com.huike.contract.domain.vo.TransferVo;
import com.huike.contract.service.ITransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/transfer")
public class TransferController extends BaseController {
    @Autowired
    ITransferService iTransferService;

    /**
     * 转派列表
     * @param sysUser
     * @return
     */
    @GetMapping("/list")
    public TableDataInfo getList(SysUser sysUser){
        List<TransferVo> result = iTransferService.selectTbClueList(sysUser);
        return getDataTable(result);
    }

    /**
     * 转派线索/商机
     */
    @PutMapping("/assignment/{type}/{userId}/{transferUserId}")
    public AjaxResult assignment(@PathVariable String type,@PathVariable Long userId,@PathVariable Long transferUserId){
        iTransferService.updateAssignment(type,userId,transferUserId);
        return AjaxResult.success("操作成功");
    }

}